Skip to content

Warn when yearly seasonality is forced on with insufficient history (#2709)#2736

Open
anp-exe wants to merge 1 commit into
facebook:mainfrom
anp-exe:warn-underidentified-yearly-seasonality
Open

Warn when yearly seasonality is forced on with insufficient history (#2709)#2736
anp-exe wants to merge 1 commit into
facebook:mainfrom
anp-exe:warn-underidentified-yearly-seasonality

Conversation

@anp-exe
Copy link
Copy Markdown

@anp-exe anp-exe commented Jun 5, 2026

Fixes #2709.

When yearly_seasonality=True is set explicitly on under ~2 years of data, the yearly component is under-identified and the trend/seasonality split becomes unstable across Prophet/Stan versions (the linked issue shows the same data producing +2.9M vs -12.4M forecasts depending on environment).

The instability itself is fundamental to the math, so this doesn't try to "fix" the forecasts. Instead it adds the safeguard the reporter asked for: a logger.warning in set_auto_seasonalities() when yearly seasonality is forced on with insufficient history, so users get a clear heads-up rather than unstable output.

The warning fires only when seasonality is forced on with under 730 days of data. It stays silent on 'auto' (which already disables yearly seasonality with its own info-level message) and when there are >= 2 years of data.

Includes two tests in test_prophet.py covering both the warning case and the no-warning-on-auto case.

Copilot AI review requested due to automatic review settings June 5, 2026 14:59
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Jun 5, 2026

Hi @anp-exe!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Jun 5, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yearly seasonality with only 12 monthly points leads to different results due to version dependencies

2 participants